public class Test {
    public static void main1(String[] args) {
        int a = 0;
        try{
           a = 10 / a;
        }catch (ArithmeticException e){
            e.printStackTrace();
            System.out.println("输出的是零");
        }finally{
            System.out.println("输出时finally");
        }
        System.out.println("继续进行代码");
    }


    public static void main2(String[] args) throws ArithmeticException{
        int a = 0;
        a = 10 / a;
    }

    public static void main3(String[] args) {
        StringBuffer stringBuffer = new StringBuffer("helloworld");
        stringBuffer.append(12);
        System.out.println(stringBuffer);
        String a = "abcDsAC";
        System.out.println(a.length());
        StringBuilder stringBuilder = new StringBuilder();
        for(int i = 0;i < a.length();i++){
            char b = a.charAt(i);
            if(b >='A'&&b <='Z'){
                b += 32;
            }
            stringBuilder.append(b);
        }
        System.out.println(stringBuilder);
    }


    public static void main4(String[] args) {
        Student student1 = new Student();
        Student student2 = new Student();
        String name1 = "1";
        String name2 = "1";
        student1.id = "12345";
        student2.id = "12345";
        System.out.println(student1.id.equals(student2.id));
        System.out.println(student1.equals(student2));
        System.out.println(name1.equals(name2));
    }


    public static void main5(String[] args) {
        Student student1 = new Student();
        Student student2 = new Student();
        student1.id = "12345";
        student2.id = "12345";
        System.out.println(student1.hashCode());
        System.out.println(student2.hashCode());

    }


    public static void main6(String[] args) {
        Student student1 = new Student("l",10);
        Student student2 = new Student("l",10);
        System.out.println(student1.hashCode());
        System.out.println(student2.hashCode());
        System.out.println(student1.equals(student2));
    }


    public static void main8(String[] args) throws CloneNotSupportedException {
        CloneTest cloneTest = new CloneTest("zhangsan");
        CloneTest cloneTest1 =(CloneTest) cloneTest.clone();
        System.out.println(cloneTest1);
    }


    public static void main7(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person("zhangsan",21);
        Person person2 =(Person) person1.clone();
        System.out.println(person2);
    }

//浅拷贝
    public static void main9(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person("zhangsan",10);
        Person person2 =(Person) person1.clone();
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        System.out.println("=============");
        person2.m.money = 10.0;
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }

//深拷贝
    public static void main(String[] args) throws CloneNotSupportedException{
        Person person1 = new Person("zhangsan",10);
        Person person2 =(Person) person1.clone();
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
        System.out.println("=============");
        person2.m.money = 10.0;
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }
}
